home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.3 KB | 50 lines | [TEXT/GEOL] |
- Item 2645350 10-Jan-91 14:46PST
-
- From: BERDAHL Amoco Tech, Eric Berdahl,VAR
-
- To: DEREK White, Derek
- MACAPP.TECH$ MacApp Technical
-
- ------------------------------------------------------------------------------
-
- Sub: Re[2]:Pascal '9x(was Pascal++)
-
- Derek,
-
- Pardon me for inserting some stock into this already brewing stew, but there
- are some trains simply must be stepped in front of.
-
- I agree with your concept of returning references not being necessary in
- Pascal, as the central issues the feature addresses are already dealt with.
- However, your comments, “At the implementation level there is no difference
- between returning a C++ reference and a C++ pointer. The Object Pascal
- interfaces to a C++ routine would just show a pointer being returned instead of
- a reference.”, are misleading. At the compiler implementation level, there is
- a big difference between returning a C++ reference and a C++ pointer. At the
- source code level, there may or not be a difference, depending on how you wish
- to treat the problem.
-
- The syntactic sugar C++ does to return a reference is like this: The calling
- function constructs a temporary variable. A pointer to this temp is pushed on
- the stack and the invoked routine actually (at the assembly level) acts on the
- temp in the stack frame of the calling function (hence, we really don’t need to
- worry about copy constructors when references are returned). The function
- itself returns nothing. Got that? Ok, now returning a pointer is different.
- In this case, no temp exists and the function really returns a pointer. See
- the difference? This discussion assumes the use of AT&Ts C++ compiler. Unless
- you intend to change this situation, Pascal will need to differentiate between
- C++ references and pointers.
-
- I also wish to thank you for clearly noting one of the intentions of the Pascal
- '9x project: to have greater support for C++ linkage. Personally, I thought
- Pascal++ was a poor name, given what I’ve seen, Eiffel-- would be more
- appropriate, but I digress. The C++ world has lots of neat stuff to offer the
- development community, and I’m very happy that we’ll be able to share it with a
- wider audience.
-
- Still stirring,
- Eric Berdahl
- Amoco Technology Company
- AppleLink: BERDAHL
-
-